import request from '@/utils/request'
import type {CheckTask} from '@/types/checkTask'

export interface ElderAndDate {
    elderId: number,
    date?: string
}


// 添加检查任务
export const addCheckTask = (data: CheckTask) => {
    return request<boolean>({
        url: '/elder/addCheckTask',
        method: 'post',
        data
    })
}

// 更新检查任务
export const updateCheckTask = (data: CheckTask) => {
    return request<boolean>({
        url: '/elder/updateElderCheckTask',
        method: 'post',
        data
    })
}

// 删除检查任务
export const deleteCheckTask = (id: number) => {
    return request<boolean>({
        url: '/elder/delElderCheckTask',
        method: 'delete',
        params: {id}
    })
}

// 获取老人的检查任务列表
export const getElderCheckTasks = (params: ElderAndDate) => {
    return request<CheckTask[]>({
        url: '/elder/getElderCheckTask',
        method: 'get',
        params
    })
}